/**
 * libnlog -- User friendly logging system with network support.
 *
 * Copyright (C) 2011
 * 	Samuel Nussbaum <samuel (dot) nussbaum (at) e-robot.ch>
 *
 * This library is free software; you can redistribute it and/or modify it under the terms of the
 * GNU Lesser General Public License as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 */
#ifndef STREAM_H_
#define STREAM_H_

#include "Types.hpp"
#include "Message.hpp"

namespace nlog {

class Logger;

class Stream
{
	public:
		Stream(LevelEnum _level, const Logger &_target);
		Stream(const Stream &);
		virtual ~Stream();
		inline Stream &operator<<(bool _value);
		template <typename Type> inline Stream &operator<<(Type _value);

	protected:
		Message m_message;
		OStringStream m_stream;
		const Logger &m_target;
};

inline Stream &Stream::operator<<(bool _value) {
	m_stream << (_value ? "true" : "false");
	return *this;
}

template <typename Type>
inline Stream &Stream::operator<<(Type _value) {
	m_stream << _value;
	return *this;
}

}

#endif /* STREAM_H_ */
